from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
from pydantic.types import UUID4
from app.schemas.archivable import Archivable

# 基础模型
class TaskClassificationLibraryBase(BaseModel):
    category_name: Optional[str] = Field(description="任务分类名")
    # usage_count: Optional[int] = Field(description="使用次数")

# 创建模型
class TaskClassificationLibraryCreate(TaskClassificationLibraryBase):
    # category_name: Optional[str] = Field(description="任务分类名")
    # usage_count: int = 0
    pass

# 更新模型
class TaskClassificationLibraryUpdate(TaskClassificationLibraryBase):
    pass

# 数据库基础模型
class TaskClassificationLibraryInDBBase(TaskClassificationLibraryBase, Archivable):
    id: UUID4
    usage_count: Optional[int]
    created_at: Optional[datetime]
    updated_at: Optional[datetime]

    # class Config:
    #     from_attributes = True
        # allow_population_by_field_name = True

# 返回模型
class TaskClassificationLibrary(TaskClassificationLibraryInDBBase):
    pass

# 数据库模型
class TaskClassificationLibraryInDB(TaskClassificationLibraryInDBBase):
    user_id: Optional[UUID4]
